package com.gallop.mq.core.template.handler.registry;

/**
 * MQ具体监听方法参数列表容器
 */
public class ListenerArgs {
    private final Object[] args;

    private ListenerArgs(Object[] args) {
        this.args = args;
    }

    public static ListenerArgs of(Object... args) {
        return new ListenerArgs(args);
    }

    @SuppressWarnings("unchecked")
    public <T> T getArgAs(int index) {
        if (args == null || args.length <= index) {
            return null;
        }
        return (T) args[index];
    }
}
